home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 February: Technology Seed / Mac Tech Seed Feb '97.toast / OpenDoc 1.2b2c1 / Implementation / Utilities / TempIter.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1997-02-13  |  7.0 KB  |  359 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        TempIter.cpp
  3.  
  4.     Contains:    xxx put contents here xxx
  5.  
  6.     Owned by:    Doug Hill
  7.  
  8.     Copyright:    © 1996 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.          <3>     9/17/96    RA        1360817: TempODEmbeddedFramesIterator
  13.                                     should handle NULL from CreateEmbedded...
  14.          <2>     7/26/96    DH        Fixed iterator classes that descend from
  15.                                     BaseTempObj to initialize their member
  16.                                     object to null before allocation.
  17.  
  18.     To Do:
  19. */
  20.  
  21. /*
  22.     File:        TempIter.cpp
  23.  
  24.     Contains:    Template utilities for OpenDoc iterators
  25.  
  26.     Owned by:    Jens Alfke
  27.  
  28.     Copyright:    © 1995 by Apple Computer, Inc., all rights reserved.
  29.  
  30. */
  31.  
  32.  
  33. #ifndef SOM_ODDragAndDrop_xh
  34. #include <DragDrp.xh>
  35. #endif
  36.  
  37. #ifndef _TEMPITER_
  38. #include "TempIter.h"
  39. #endif
  40.  
  41. #ifndef SOM_ODFrame_xh
  42. #include <Frame.xh>
  43. #endif
  44.  
  45. #ifndef SOM_ODFacet_xh
  46. #include <Facet.xh>
  47. #endif
  48.  
  49. #ifndef SOM_ODFacetIterator_xh
  50. #include <FacetItr.xh>
  51. #endif
  52.  
  53. #ifndef SOM_ODEmbeddedFramesIterator_xh
  54. #include <EmbFrItr.xh>
  55. #endif
  56.  
  57. #ifndef SOM_ODFrameFacetIterator_xh
  58. #include <FrFaItr.xh>
  59. #endif
  60.  
  61. #ifndef SOM_ODWindowState_xh
  62. #include <WinStat.xh>
  63. #endif
  64.  
  65. #ifndef SOM_ODWindowIterator_xh
  66. #include <WinIter.xh>
  67. #endif
  68.  
  69. #ifdef _OD_IMPL_
  70. #ifndef SOM_ODDragAndDrop_xh
  71. #include <DragDrp.xh>
  72. #endif
  73.  
  74. #ifndef SOM_ODDragItemIterator_xh
  75. #include <DgItmIt.xh>
  76. #endif
  77. #endif
  78.  
  79. #ifndef SOM_ODFocusSet_xh
  80. #include <FocusSet.xh>
  81. #endif
  82.  
  83. #ifndef SOM_ODFocusSetIterator_xh
  84. #include <FocusItr.xh>
  85. #endif
  86.  
  87. #ifndef SOM_ODTypeList_xh
  88. #include <TypeList.xh>
  89. #endif
  90.  
  91. #ifndef SOM_ODTypeListIterator_xh
  92. #include <TypLsItr.xh>
  93. #endif
  94.  
  95. #ifndef _ODMEMORY_
  96. #include "ODMemory.h"
  97. #endif
  98.  
  99. //=====================================================================================
  100. // TempODFacetIterator
  101. //=====================================================================================
  102.  
  103. TempODFacetIterator::TempODFacetIterator( Environment *ev, ODFacet *fa,
  104.                                           ODTraversalType tt, ODSiblingOrder so )
  105.     :BaseTempObj(),
  106.      fEv(ev)
  107. {
  108.     fObj = kODNULL;
  109.     fObj = fa->CreateFacetIterator(ev,tt,so);
  110.     this->First();
  111. }
  112.  
  113.  
  114. ODFacet*
  115. TempODFacetIterator::First( )
  116. {
  117.     return fCurrent = ((ODFacetIterator*)fObj)->First(fEv);
  118. }
  119.  
  120.  
  121. ODFacet*
  122. TempODFacetIterator::Next( )
  123. {
  124.     return fCurrent = ((ODFacetIterator*)fObj)->Next(fEv);
  125. }
  126.  
  127.  
  128. ODBoolean
  129. TempODFacetIterator::IsNotComplete( )
  130. {
  131.     return ((ODFacetIterator*)fObj)->IsNotComplete(fEv);
  132. }
  133.  
  134.  
  135. //=====================================================================================
  136. // TempODFrameFacetIterator
  137. //=====================================================================================
  138.  
  139. TempODFrameFacetIterator::TempODFrameFacetIterator( Environment *ev, ODFrame *fr )
  140.     :BaseTempObj(),
  141.      fEv(ev)
  142. {
  143.     fObj = kODNULL;
  144.     fObj = fr->CreateFacetIterator(ev);
  145.     this->First();
  146. }
  147.  
  148.  
  149. ODFacet*
  150. TempODFrameFacetIterator::First( )
  151. {
  152.     return fCurrent = ((ODFrameFacetIterator*)fObj)->First(fEv);
  153. }
  154.  
  155.  
  156. ODFacet*
  157. TempODFrameFacetIterator::Next( )
  158. {
  159.     return fCurrent = ((ODFrameFacetIterator*)fObj)->Next(fEv);
  160. }
  161.  
  162.  
  163. ODBoolean
  164. TempODFrameFacetIterator::IsNotComplete( )
  165. {
  166.     return ((ODFrameFacetIterator*)fObj)->IsNotComplete(fEv);
  167. }
  168.  
  169.  
  170. //=====================================================================================
  171. // TempODEmbeddedFramesIterator
  172. //=====================================================================================
  173.  
  174. TempODEmbeddedFramesIterator::TempODEmbeddedFramesIterator( Environment *ev,
  175.                                                             ODPart *part, ODFrame *fr )
  176.     :BaseTempObj(),
  177.      fEv(ev)
  178. {
  179.     fObj = kODNULL;
  180.     fObj = part->CreateEmbeddedFramesIterator(ev,fr);
  181.     if (fObj == kODNULL) THROW(kODErrCannotEmbed);
  182.     this->First();
  183. }
  184.  
  185.  
  186. ODFrame*
  187. TempODEmbeddedFramesIterator::First( )
  188. {
  189.     return fCurrent = ((ODEmbeddedFramesIterator*)fObj)->First(fEv);
  190. }
  191.  
  192.  
  193. ODFrame*
  194. TempODEmbeddedFramesIterator::Next( )
  195. {
  196.     return fCurrent = ((ODEmbeddedFramesIterator*)fObj)->Next(fEv);
  197. }
  198.  
  199.  
  200. ODBoolean
  201. TempODEmbeddedFramesIterator::IsNotComplete( )
  202. {
  203.     return ((ODEmbeddedFramesIterator*)fObj)->IsNotComplete(fEv);
  204. }
  205.  
  206.  
  207. //=====================================================================================
  208. // TempODWindowIterator
  209. //=====================================================================================
  210.  
  211. TempODWindowIterator::TempODWindowIterator( Environment *ev, ODWindowState *ws )
  212.     :BaseTempObj(),
  213.      fEv(ev)
  214. {
  215.     fObj = kODNULL;
  216.     fObj = ws->CreateWindowIterator(ev);
  217.     this->First();
  218. }
  219.  
  220.  
  221. ODWindow*
  222. TempODWindowIterator::First( )
  223. {
  224.     return fCurrent = ((ODWindowIterator*)fObj)->First(fEv);
  225. }
  226.  
  227.  
  228. ODWindow*
  229. TempODWindowIterator::Next( )
  230. {
  231.     return fCurrent = ((ODWindowIterator*)fObj)->Next(fEv);
  232. }
  233.  
  234.  
  235. ODBoolean
  236. TempODWindowIterator::IsNotComplete( )
  237. {
  238.     return ((ODWindowIterator*)fObj)->IsNotComplete(fEv);
  239. }
  240.  
  241.  
  242. //=====================================================================================
  243. // TempODDragItemIterator
  244. //=====================================================================================
  245.  
  246. #ifdef _OD_IMPL_
  247.  
  248. TempODDragItemIterator::TempODDragItemIterator( Environment *ev, ODDragAndDrop *d )
  249.     :BaseTempObj(),
  250.      fEv(ev)
  251. {
  252.     fObj = kODNULL;
  253.     fObj = d->GetDragItemIterator(ev);
  254.     this->First();
  255. }
  256.  
  257.  
  258. ODStorageUnit*
  259. TempODDragItemIterator::First( )
  260. {
  261.     return fCurrent = ((ODDragItemIterator*)fObj)->First(fEv);
  262. }
  263.  
  264.  
  265. ODStorageUnit*
  266. TempODDragItemIterator::Next( )
  267. {
  268.     return fCurrent = ((ODDragItemIterator*)fObj)->Next(fEv);
  269. }
  270.  
  271.  
  272. ODBoolean
  273. TempODDragItemIterator::IsNotComplete( )
  274. {
  275.     return ((ODDragItemIterator*)fObj)->IsNotComplete(fEv);
  276. }
  277.  
  278. #endif /*_OD_IMPL_*/
  279.  
  280.  
  281. //=====================================================================================
  282. // TempODFocusSetIterator
  283. //=====================================================================================
  284.  
  285. TempODFocusSetIterator::TempODFocusSetIterator( Environment *ev, ODFocusSet *fs )
  286.     :BaseTempObj(),
  287.      fEv(ev)
  288. {
  289.     fObj = kODNULL;
  290.     fObj = fs->CreateIterator(ev);
  291.     this->First();
  292. }
  293.  
  294.  
  295. ODTypeToken
  296. TempODFocusSetIterator::First( )
  297. {
  298.     return fCurrent = ((ODFocusSetIterator*)fObj)->First(fEv);
  299. }
  300.  
  301.  
  302. ODTypeToken
  303. TempODFocusSetIterator::Next( )
  304. {
  305.     return fCurrent = ((ODFocusSetIterator*)fObj)->Next(fEv);
  306. }
  307.  
  308.  
  309. ODBoolean
  310. TempODFocusSetIterator::IsNotComplete( )
  311. {
  312.     return ((ODFocusSetIterator*)fObj)->IsNotComplete(fEv);
  313. }
  314.  
  315.  
  316. //=====================================================================================
  317. // TempODTypeListIterator
  318. //         ODTypeListIterator returns copies of the data, which must be disposed.
  319. //=====================================================================================
  320.  
  321. TempODTypeListIterator::TempODTypeListIterator( Environment *ev, ODTypeList *t )
  322.     :BaseTempObj(),
  323.      fEv(ev),
  324.      fCurrent(kODNULL)
  325. {
  326.     fObj = kODNULL;
  327.     fObj = t->CreateTypeListIterator(ev);
  328.     this->First();
  329. }
  330.  
  331.  
  332. TempODTypeListIterator::~TempODTypeListIterator( )
  333. {
  334.     ODDisposePtr(fCurrent); fCurrent = kODNULL;
  335. }
  336.  
  337.  
  338. ODType
  339. TempODTypeListIterator::First( )
  340. {
  341.     ODDisposePtr(fCurrent); fCurrent = kODNULL;
  342.     return fCurrent = ((ODTypeListIterator*)fObj)->First(fEv);
  343. }
  344.  
  345.  
  346. ODType
  347. TempODTypeListIterator::Next( )
  348. {
  349.     ODDisposePtr(fCurrent); fCurrent = kODNULL;
  350.     return fCurrent = ((ODTypeListIterator*)fObj)->Next(fEv);
  351. }
  352.  
  353.  
  354. ODBoolean
  355. TempODTypeListIterator::IsNotComplete( )
  356. {
  357.     return ((ODTypeListIterator*)fObj)->IsNotComplete(fEv);
  358. }
  359.